Fix key extraction for SORT

We only want to use the last STORE key, but we have to record
we actually found a STORE key so we can increment the final return
key count.

Test added to prevent further regression.

(As noted in antirez/redis-doc#392)