UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8zlG/DDWpOdGVUus9LKcmg8YQ4j8mEmzpnVQPLDqlF4=' 
WHERE 
  key_id = '8afa4045589a4443c214ea6c445f0dea6133156ae654c3fdcc638d7b18a2d7e7' 
  AND (
    token = '8zlG/DDWpOdGVUus9LKcmg8YQ4j8mEmzpnVQPLDqlF4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034