Yes. In a B-tree index, you can use a prefix of the columns.
So you can use the index for a query on 'key1' (but not as efficiently for 'key2', the column order in the index matters).
This is the same situation as in a printed telephone book, which is an index on [lastName, firstName]. You can use that to look up people by lastName easily (and not so easily by firstName, but still more efficient than calling everyone and asking for their first name).