UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VxdqeI7W2lr1quNM4LSAclGdVAbBYlUBcALZuVTmtPc=' 
WHERE 
  key_id = 'cdc7fd3285e6895289251d7e0ecac41aff04f5035f4d9eac5284d44f91368721' 
  AND (
    token = 'VxdqeI7W2lr1quNM4LSAclGdVAbBYlUBcALZuVTmtPc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037