You can find if a table is locked, and how many locks a table has, by issuing the SHOW OPEN TABLES statement. Here's an example:
mysql> SHOW OPEN TABLES;
Empty set (0.00 sec)
mysql> DESCRIBE tbl_a;
+-------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| i | int(11) | YES | | NULL | |
+-------+---------+------+-----+---------+-------+
1 row in set (0.00 sec)
mysql> SHOW OPEN TABLES;
+----------+-------+--------+-------------+
| Database | Table | In_use | Name_locked |
+----------+-------+--------+-------------+
| test | tbl_a | 0 | 0 |
+----------+-------+--------+-------------+
1 row in set (0.00 sec)
mysql> LOCK TABLE tbl_a READ;
Query OK, 0 rows affected (0.00 sec)
mysql> SHOW OPEN TABLES;
+----------+-------+--------+-------------+
| Database | Table | In_use | Name_locked |
+----------+-------+--------+-------------+
| test | tbl_a | 1 | 0 |
+----------+-------+--------+-------------+
1 row in set (0.00 sec)
If there are no open tables SHOW OPEN TABLES will return nothing, otherwise it will return a list of tables that are open. The In_use column indicates whether there are no locks (0) or the number of locks (any value greater than 0).
See
http://dev.mysql.com/doc/refman/5.1/en/show-open-tables.html for more information.
Stefan Hinz, MySQL Documentation, Berlin, Germany