How does locking work in INSERT..ON DUPLICATE KEY UPDATE statements?
This would depend on the Storage Engine.


MyISAM : Table-level locks are performed.  Consequently, all rows are locked.
InnoDB : Row-level locks are employed. Since InnoDB is transactional, all rows are locked implcitly. Those locks would be visible when you run SHOW ENGINE INNODB STATUS\G. If you want to manually lock those rows beforehand to prevent sharing, you could run SELECT ... FOR UPDATE.