UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rj3Tt4QVt3A6BLMYu7aqQ2xBc6vNu31SEuyxzud+ZIo=' 
WHERE 
  key_id = '3d8a65afe852941f2c38e28ce89118317d53a9b7d40ef2a07759ffed9579e54f' 
  AND (
    token = 'rj3Tt4QVt3A6BLMYu7aqQ2xBc6vNu31SEuyxzud+ZIo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040