How I'd go about this:
idOfKey = AnimChannel:GetClosestKeyID(when) -- the id of the key at or before "when"
later = idOfKey + 1 -- the id of the key later than "when"
frameOfKey = AnimChannel:GetKeyWhen(id)
use the above to get the key ids at the start and end of the frame range you want
e.g. between frames 15 and 25:
AnimChannel:GetClosestKeyID(15) will give you a key at or before 15 -- get its frame - if it's at 15 you have it; if not add one to keyId - make sure it's a valid keyId- get that id's frame, check it's not more than 25 - and that's the "earliest in timeline in range"
AnimChannel:GetClosestKeyID(25) will give you a key at or before 25 -- get its frame - if it's at 25 you have it; if not, check it's not less than 15 and that's the "latest in timeline in range"
there might not be a key in range; or earliest and latest may well be the same key of course!
for the whole timeline:
latest in range is the id of the key at AnimChannel:Duration() (should be AnimChannel:CountKeys()-1)
earliest in range is the id of the key at frame 0 (should be 0)
if there's only one key then it'll be at frame 0.
to go backwards between two key ids start at "latest in range" and subtract 1 from that until you get to "earliest in range"
to go forwards between two key ids start at "earliest in range" and add 1 to that until you get to until you get to "latest in range"
using AnimChannel:GetKeyWhen(keyId) as you go to find the key's frame
(and I'm sure I don't actually need to say this, but take care if you're moving keys as you go ...

)