UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'einhgS6FSEAaFe7HPhJxobVJIRMSc74CMFehG0rdfsE=' 
WHERE 
  key_id = '74d8ec7280cb012b0ec3999a8ce16af206cee4867f456044c7fa48f7d0145263' 
  AND (
    token = 'einhgS6FSEAaFe7HPhJxobVJIRMSc74CMFehG0rdfsE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032