UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GrFK80OTyrvA3TQrswq3Fj/XqGT8SZ8VhOorIbh2Ki0=' 
WHERE 
  key_id = 'e1a5ec50be0c1b6d9bcd4966bc59394d230fcbffcc99f23a63873cb3390c1768' 
  AND (
    token = 'GrFK80OTyrvA3TQrswq3Fj/XqGT8SZ8VhOorIbh2Ki0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054