UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kOr7Am16RmuJ7Gx0ZyDuBf/ovXvvJXg/GzXbwkLHfVM=' 
WHERE 
  key_id = '7b8b7e9c32428a3847112e1e2dbcd1b4134da3aabcdf615931245080e66a5746' 
  AND (
    token = 'kOr7Am16RmuJ7Gx0ZyDuBf/ovXvvJXg/GzXbwkLHfVM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035