mysql_insert_id() is perfectly safe.
It will return the last auto_increment value used on the connection that you are using to issue the mysql_insert_id() .
So if you insert a record on connection 1 and it inserts value 56, and another person inserts another record on connection two and it inserts 57, then you will still see 56 on connection 1, becuase that is the value used for your insert.