UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J7lQdhF4iRYnoZZcbxuMtuHKzGehXb5a+PeJ0CgxBDM=' 
WHERE 
  key_id = '1dc03e9ceeaf62c28762eeb852eb6afa603b509fac4f022256bd890f955e94b5' 
  AND (
    token = 'J7lQdhF4iRYnoZZcbxuMtuHKzGehXb5a+PeJ0CgxBDM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033