use more intelligent lock params
Lock to the process context and unlock only once