Detect a stale form with an optimistic version check
Two staff members open the same product form. The second save overwrites the first person's correction. A version column can detect that the submitted form is based on an older record.
Update only the version the user saw
UPDATE products
SET name = 'Updated name', version = version + 1
WHERE id = 42 AND version = 7;
Bind real values in application code and include tenant authorization. If no row matches, the record may have changed or become unavailable. Present a conflict flow that reloads current data instead of pretending the update succeeded.
Every writer must participate
The technique fails if another import or admin route updates the record without incrementing the version. Make the convention part of the write model and test all relevant paths. A timestamp can sometimes serve a similar role, but precision and update semantics need careful consideration.
Do not automatically retry a stale user edit by replacing the expected version with the latest one. That simply restores the lost-update behavior under a different name. Let the user compare changes or apply a domain-specific merge.
Test two updates with the same starting version: one should succeed and the other should report conflict. Also test a normal successive update with the new version. Keep the version separate from authorization; knowing a version number does not grant permission to edit the record.