What would be possible reasons for a DeadLock to occur in Mysql Database?
Why DELETE+INSERT instead of UPDATE ??

Do you have BEGIN...COMMIT around the statements?

Are you hitting multiple rows in the DELETE and/or INSERT?

Are you doing DELETE ... WHERE domain_id = ... ?  If so, notice that you have no index, hence it will have to scan the whole table!

(Sorry, that does not even begin to answer the question you posed.  But it may lead to a solution to the real question.)