UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q90Di3Y2vQdzjOXLUr9xeRICKPOgXGE9ManH0+Ufef4=' 
WHERE 
  key_id = '8e99f98554dde53f4fc56358c68f4112cda847c95fce1bfebef71a8482d5ea2b' 
  AND (
    token = 'Q90Di3Y2vQdzjOXLUr9xeRICKPOgXGE9ManH0+Ufef4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051