UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0uueC0uLWSn7QkWWNNGYMHjSzzyy5toinDYcAlEeyZI=' 
WHERE 
  key_id = '0af5ef7980ccdde604e6b0a0b2b61b6bc0b6dc746f01e4ca8127e7965c940267' 
  AND (
    token = '0uueC0uLWSn7QkWWNNGYMHjSzzyy5toinDYcAlEeyZI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023