Insert and select the row autoincremented id
No.  Instead:

INSERT ...
SELECT LAST_INSERT_ID();


LAST_INSERT_ID() is session-specific, so there is never any confusion with other threads also inserting into the same table.

Also, there is no need for BEGIN ... COMMIT for this pair of statements.  (You may need it if there are other statements.)