UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dAaO7klpUdu6xnfA5rXVKMZ27r40Skyijp28cmSkPl0=' 
WHERE 
  key_id = '74867c1cb28eee4fde46cbc482dc65db206ac849dcc207dff36d94e3bd718e86' 
  AND (
    token = 'dAaO7klpUdu6xnfA5rXVKMZ27r40Skyijp28cmSkPl0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00066