Revolut interview question

Compare optimistic vs pessimistic DB locking and when to use?