What type of lock? There are so many… layers alone have like 7 or 8 types of lock; protection tags can lock certain axes and movements alone; then there is lock against selection in the selection filters; and of course the visibility filters but I guess you wouldn’t call that lock.
If you often change the lock status of many objects, keeping a “lock layer” for this purpose alone is very useful (since layers can be applied easily on several objects at once). Sadly, an object can only be in one layer at a time so solving the issue per layer prevents the affected objects from being in any other layer in the first place.
If you need to lock against movement, you could create a script that adds (or changes) a protection tag for each selected object. This would not affect the layer assignments.