UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+K8txr8I5cZ4w9vUuJlZ5mch6tg5+rI2XqqBmU573+c=' 
WHERE 
  key_id = '3a22cc9dc1f5156c3c6a850d27942f89f0ba616589591f0eed81a7fffe1c7937' 
  AND (
    token = '+K8txr8I5cZ4w9vUuJlZ5mch6tg5+rI2XqqBmU573+c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040