UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MGD9aopgfqzK0LbElpYx8QwoCUMz7UeJ62uDmeAB8/w=' 
WHERE 
  key_id = 'd4a88690d7ca83a36460930558f5350f2011fdf1fcb29a72511d71508b26924a' 
  AND (
    token = 'MGD9aopgfqzK0LbElpYx8QwoCUMz7UeJ62uDmeAB8/w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031