Použijte LAST_INSERT_ID() funkce: update table whatever set product_id = id where id = last_insert_id()