Prevent race condition in get_or_create

If two instances launch the request at the same time, one may fail.