I think the best way is to name you mates a specific name. Then you can check to see if that mate already exists. Here is a macro I created in C# that shows that method.
Another thing you could try is add a mate ANTI-ALIGNED. If is returns an error, then you know to remove it. If it doesn't return an error, then you can align the mate. There are some caveats with that method and I haven't tried it, but it might work for your situation.