UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X2vvFnKwmEIVOebdgKqZdZcD9+nZ/chpRvd3Urzaiko=' 
WHERE 
  key_id = 'f613e155ac24e540ccc114943e8c02ea72e3fd7b731f1d6696ba389227a3cc6d' 
  AND (
    token = 'X2vvFnKwmEIVOebdgKqZdZcD9+nZ/chpRvd3Urzaiko=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028