UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MvD+dW210HftRrXn+buJrifWX2vOqHpRa8ZcrU1uB5A=' 
WHERE 
  key_id = '4530f8bf3db65976d1abe38da6dd2485a0b121ecd42c38a188f0352df1cb6c51' 
  AND (
    token = 'MvD+dW210HftRrXn+buJrifWX2vOqHpRa8ZcrU1uB5A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030