Perfect question! When you add console.log, three things happen:
1. Time delay: Logging takes 1-10ms per call
2. Event loop: Node.js yields to other events during I/O
3. JavaScript is single-threaded: The yield gives the first request time to finish and commit
Without logging, both requests race through. With logging, request A gets enough time to complete before request B even starts.
The fix: Use database transactions with proper isolation levels, not application-level checks.