UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 's6AYsHqQJ1vut1YTflIKM5mGSKavpLVZOwIZIdZc+ds=' 
WHERE 
  key_id = 'a2314c3e8bae7b39d67861eb1114e1e7bb9593b5bf84eb0e67308e4c84709116' 
  AND (
    token = 's6AYsHqQJ1vut1YTflIKM5mGSKavpLVZOwIZIdZc+ds=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030