update lock function