UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ODNDk7YoRUNtuvVKzrIV/Ucr532r1nUeMTJCpIRdmOo=' 
WHERE 
  key_id = '4e62533b9b238abde27f950e52d31eaffac5d00156fdb97532b8f321c16022d9' 
  AND (
    token = 'ODNDk7YoRUNtuvVKzrIV/Ucr532r1nUeMTJCpIRdmOo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028