HF RL Explorer

Rework database locking to use upserts when possible

Rework database locking to use upserts when possible: a task in lifesci-drug-discovery-swe-envs-nocap (Harbor dataset). Title: Rework database locking to use upserts when possible

The task

**Title:** Rework database locking to use upserts when possible

Part of scalingX/lifesci-drug-discovery-swe-envs-nocap.