Use lock when updating prepared stmt cache