UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd4mzcOibCRq4lG+0Dy0T1166x34tM8UfFhB3l8FmmWY=' 
WHERE 
  key_id = '6a9ac33c88fe6a9fba9da4fc4176c9048ce2e3d763a0306b080183533375cb20' 
  AND (
    token = 'd4mzcOibCRq4lG+0Dy0T1166x34tM8UfFhB3l8FmmWY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050