Lower the time spent scanning lastseen DB.

The total DB access time will thus not depend on the time spent running the callback (it seems to be huge in the case of reverse DNS resolution).

This commit makes it easier to later convert the scan into an RDONLY operation.
Merge pull request #1744 from jeffali/fix/scankeys

Lower the time spent scanning lastseen DB.