UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gmpEVj1jBJXCyueV8Y0dJUR0CuYyxiitLFxX/KA9pVY=' 
WHERE 
  key_id = '94502080bc44987e5b89e102c92d23704d6fa18b838d3a09f12e61fc02b5aa8a' 
  AND (
    token = 'gmpEVj1jBJXCyueV8Y0dJUR0CuYyxiitLFxX/KA9pVY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053