Meh ... Don't have a lot of time ,
But that's how I would go about it !
An Array
Enemy ( Variables : LockUID , Move toward enemy UID depending on variable )
Missile
For Each Missile
-- (Ordered) For Each Enemy depending on distance(Missile.X,Missile.Y,Enemy.X,Enemy.Y)
--- (invert) Enemy.UID is in array
---- Push UID in Array
---- Set LockUID to Enemy.UID
Here we go ... Hope that helped !