it's hard to guess what the problem may be without a more detailed breakdown of the timings. could you expand your logs to include the time at each phase?
attempt lock
do stuff
release lock
... and you may want to make those additional logs conditional on some environment flag.