UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0qVycxljAgPAtleB6YA5dsOBAmRczAZUmuCS7XcXkpM=' 
WHERE 
  key_id = '422a087422cdc3b18beb6054806e4dd027316e210607fb094b61fac6d6cc3163' 
  AND (
    token = '0qVycxljAgPAtleB6YA5dsOBAmRczAZUmuCS7XcXkpM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052