There is a good article on this: https://vladmihalcea.com/logical-vs-physical-clock-optimistic-locking