Shopee interview question

Q: What is the difference between optimistic and pessimistic locks?