Fixed a race condition in QuerySet.update_or_create() that could result in data loss (#29499). Signed-off-by: Rosen Penev <rosenp@gmail.com>