MySQL UPSERT vs SELECT–UPDATE–INSERT

Race Conditions, Transactions, and updatedAt Gotchas (MySQL 5.7 & 8.0)