IS_USED_LOCK()
IS_USED_LOCK(string)This function determines whether the name given is already in use as a lock name. If the lock name is in use, it returns the connection identifier of the client holding the lock. It returns NULL if it is not in use. Locks are created by GET_LOCK(). This function is available as of version 4.1.0 of MySQL. Here is an example:
SELECT IS_USED_LOCK('my_lock');
+-------------------------+
| IS_USED_LOCK('my_lock') |
+-------------------------+
| 1 |
+-------------------------+The results here indicate that the lock is in use and the connection identifier of the client is 1.