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

Query time 0.00026