http://dev.mysql.com/doc/refman/5.0/en/internal-locking.html
The following is the extract from the documentation.
mysql> LOCK TABLES real_table WR
how will I know that some tables are locked?
You can use SHOW OPEN TABLES command to view locked tables.
how do I unlock tables manually?
If you know the session ID that locked tables - 'SELECT CONNECTION_ID()', then you can run KILL command to terminate session and unlock tables.