UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bCJvIPqaeWjlkroyAe2T9GSW5dga2FVZDVKFiEn4uGw=' 
WHERE 
  key_id = '1b9925a64d56be7b6740582627b871b4d74877f54364edf9262a640da79042ce' 
  AND (
    token = 'bCJvIPqaeWjlkroyAe2T9GSW5dga2FVZDVKFiEn4uGw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029