[mysql] Unlocking tables if thread is lost