MDL-25500 locking: Added mysql locks.