It depends on where they are when they leave your reach
Looking at the rules for Opportunity Attacks:
You can make an opportunity attack when a hostile creature that you can see moves out of your reach. To make the opportunity attack, you use your reaction to make one melee attack against the provoking creature. The attack occurs right before the creature leaves your reach.
So the attack will happen before the creature leaves a space that is within your reach. Or said another way, just before it's left a grid square that is in your reach a creature can attack.
And per the optional rules of flanking:
Flanking on Squares. When a creature and at least one of its allies are adjacent to an enemy and on opposite sides or corners of the enemy’s space, they flank that enemy, and each of them has advantage on melee attack rolls against that enemy.
So the key part of this is, the two characters need to be on opposite sides of the creature in order to be "flanking".
To diagram it out
1 A 3
4 Z 6
7 B 9
A is your character,
B is the ally on the other side of the flank and
Z is the creature on the move.
Z attempts to move to
9, then they would still be flanked when leaving your area. So
A would get an AoO, but not
B. Similarly, if
Z tried going to
B would get the AoO with advantage, but not
So in all of these cases, yes, one of the characters would have advantage due to flanking. But the creature would have not left the reach of the other character, so they do not get any attack.
Z moved sideways first, to either
6, then they have not left your reach yet so there is no Opportunity Attack. This also means that flanking is no longer an issue. From here,
Z can move as they wish.
This "sideways" movement does not work on a grid if
B are diagonally flanking
Z as every open square moves
Z out of at least one of the pair's range.
This same sideways movement can happen (and I believe even more likely due to how "opposite" on a grid works) with creatures that are of size Large or bigger.
Long answer, short
If the creature moves away from one character towards another, before leaving their square, one character can make an Opportunity Attack at advantage due to flanking.
Depending on how the characters and creature are arranged, if the creature spends an extra 5' of movement to go sideways first, they can get out of the flanked situation without leaving anyone's reach. From there they can move in any other direction. They will still be subject to AoO attacks, but none of which are at advantage from flanking.
So it all depends on the direction the creature takes as to whether the flanking condition still exists.