Make overriding branch settings thread-safe LMS-11125

https://openedx.atlassian.net/browse/LMS-11125

*Note*: As described in the ticket, this is an actual issue in Studio. When exporting a course, we temporarily set the branch_setting to `published_only`. This could potentially collide with other requests that are active at the same time (they would not see Draft content).

@cpennington @dmitchell @sarina  Please review.

Updating the Split Modulestore to use the new branch_setting implementation is a separate PR: https://github.com/edx/edx-platform/pull/4514
Docstrings are much clearer, thanks!