I'm kinda confused on the issue.
A 42t ring with 11-45 cassette is what you currently have and you want to move to a 15-40 cassette?
If that's correct, you are looking to reduce both the low and high gearing. So you don't use the first few small cogs or the last couple large cogs?
If that's correct, then wheelsmcgee ha a solid suggestion- get a smaller ring and smaller overall cassette range.
compare gear inch options on a website and go from there.