UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S0j8zTUl/bGBiyVmc2UqGnjA9EXxGr+BTV90YokxcMs=' 
WHERE 
  key_id = '6328101583441d67d65856107221eeef5a820966bf8bd1baac306ee29b8390bf' 
  AND (
    token = 'S0j8zTUl/bGBiyVmc2UqGnjA9EXxGr+BTV90YokxcMs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028