UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Qqdw5F85XGtLDO5CWlkuUKmVZ3jEMcuCfZT6WAkPiWM=' 
WHERE 
  key_id = '379f47ae03c2d7a4580f422047e64014d0593ef96abeca1cfbe07c444047ef36' 
  AND (
    token = 'Qqdw5F85XGtLDO5CWlkuUKmVZ3jEMcuCfZT6WAkPiWM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044