UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HZOn7eE2pG+IVGjGes+4wrT+hVjCzvu1pADz92Ar0vA=' 
WHERE 
  key_id = 'a81ca4bf24f42795602f1302c3efc167adc4391035725e376fe3b57395ff4c06' 
  AND (
    token = 'HZOn7eE2pG+IVGjGes+4wrT+hVjCzvu1pADz92Ar0vA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029