Two customers can buy the last copy of a book at the same moment, and a checkout that fails halfway leaves the database lying. Transactions make groups of statements all-or-nothing, and InnoDB's locks and row versions decide what concurrent transactions see of each other, on MySQL 9.7 524 's defaults.
The examples are transcripts of real runs, in which a script drove one mysql client per session: Session A> is a statement sent, Session A: what came back, and (waiting) a statement still blocked after half a second. Redundant acknowledgments (Query OK, 0 rows affected, 1 row in set) are omitted, and each run starts from a fresh bookshop, where product 5 has 7 copies.