Wrap order updating with with_lock in order to (probably) fix order deadlocking issues

Fixes #2683