Turret has a 'has target' and a 'on target acquired' condition.
Turret has also the expression 'Sprite.Turret.TargetUID'
So, ''on target acquired' you can set Sprite.Turret.TargetUID to an instance variable of the turret. You just have to check first if there is no other instance variable of any other turret set with to that UID. Like this:
System > pick by comparisation > expression = sprite.variable > value = Sprite.Turret.TargetUID > object = sprite.
Then you check in a sub event if sprite.PickedCount = 0
If zero, you know there is no other turret with that target.
Then, to reset that variable to 'zero target', you use the 'has target' condition combined with an else to 'untarget' de variable.
Attention. The UID zero exist. If you have a sprite with UID zero, you will run into problems, when you set the variable to zero to represent a 'no target'. If you have a sprite combined with a turret with UID zero, then copy it in the layout, keep the copy and delete the original. UID zero is now gone.