Thats not how you are supposed to do it, you are supposed to leave the key for the channel blank:

/join -inx #chan1,#chan2,#chan3 key1,,key3

That uses a key on #chan1 and #chan3.