UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Fkl1xog2XjmiDTGK6R89i9T29WQ04PzgLERQpl0er6M=' 
WHERE 
  key_id = '1247da2500766aba300651eed3b33eda9d702cb843e596c291567d25eaab268a' 
  AND (
    token = 'Fkl1xog2XjmiDTGK6R89i9T29WQ04PzgLERQpl0er6M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030