LOCK TABLE - фтопь
TLoD,Snake 28.01.2008 23:09
Если глянуть в доку по мусклю:
For LAST_INSERT_ID(), the most recently generated ID is maintained in the server on a per-connection basis. It is not changed by another client. It is not even changed if you update another AUTO_INCREMENT column with a non-magic value (that is, a value that is not NULL and not 0). Using LAST_INSERT_ID() and AUTO_INCREMENT columns simultaneously from multiple clients is perfectly valid. Each client will receive the last inserted ID for the last statement that client executed.
Не думаю, что вы используете многопоточную среду, делящую один объект-коннэкшн между тредами.