Trying to avoid bad MySQL database design - can't figure out how to avoid too many columns
Anytime you'd start getting a col1, col2, col3 in a database design, you "typically" want to consider those columns as rows in another table.  (typically, there are always exceptions - doubtful this is the case ;) )

So you have a LEGO_SETs and LEGO_PARTs table already ?

Sounds like you have something like this:

table: LEGO_SET
SET_ID
name
... etc ..
PART_1
QTY_1
PART_2
QTY_2
... etc.

table: LEGO_PART
PART_ID


You have here a many to many relationship. (ie A Lego_Set has many Lego_parts. A Lego_Part may belong to many Lego_sets).

You should have an interim table to help resolve this:
Remove the PART_1, QTY_1, etc. from LEGO_SET table and do this:

table: LEGO_PART_SET
SET_ID
PART_ID
QTY


that's it.

So if you have SET_ID 123, having Lego_parts 333 and 444.
You would have 2 rows in this table:

SET_ID  PART_ID  QTY
123     333       12
123     444       4


Hope that helps.

[edit]
Edited based on comments: Don't use SET table, avoid reserved words.
[/edit]