lock write access to DB