Improve create_or_update to work without cache locks