Eran Galperin has made a recent post about performing multiple row operations in MySQL - inserts and updates.
Multiple row operations are in common use in a normalized application databases as one database entity is often linked to multiple sub-entities (for example a user and his tags). [...] Too often I've seen such queries ran in long loops one at a time, which is very bad for performance (as I will show here) and sometimes equally bad for integrity (if the process is interrupted). So what are the alternatives?
His alternatives include concatenation of values for an insert (rather than looping) and updating the information with a "ON DUPLICATE KEY UPDATE" statement or, for multiple tables, using a join.