UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'z+1IFTDQOxV3QGjL+BGtr9ZBdQVI/yqYJudILMvxLcI=' 
WHERE 
  key_id = '7e319020a84df8bdd33598019acfe491126a3c416172fdf8be84fb7156b7360f' 
  AND (
    token = 'z+1IFTDQOxV3QGjL+BGtr9ZBdQVI/yqYJudILMvxLcI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030