- If it's an InnoDB based database use SHOW ENGINE INNODB STATUS\G
- Check SHOW FULL PROCESSLIST; to verify if any queries are running now (or just stuck).
- If you use MyISAM or just need some more information, enable the MySQL debug mode by using > mysqladmin -uuser -ppassword debug and then check for the output at the error log.
- Consider using tools such as mysqlreport (it has a nice explanation here) or mysqltuner to verify your server configuration.
Locked database is not a nice thing, but it can be detected and eliminated...