UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f8aOxV2o733cCAPZajoPLdp1m2HI7l/BedbJNXqzvkU=' 
WHERE 
  key_id = '742366ceeab1e11701a14979795c8d916f0544042fce3f7a9de6c89abc1e80d6' 
  AND (
    token = 'f8aOxV2o733cCAPZajoPLdp1m2HI7l/BedbJNXqzvkU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030