When updatedb is run for the first time, there is no way to avoid scanning every directory.
But on subsequent scans, if a directory's mtime is unchanged from its old entry in the locate database, there are no new files and no new subdirectories - so instead of scanning the complete directory, updatedb can just use its old database to know the names of any existing sub-directories. So it can proceed directly to checking the mtimes of those subdirectories, and apply the same rule to them.
In other words, if a filesystem is unchanged since the previous updatedb run, the only thing updatedb needs to do to confirm it is to stat() each directory entry it already has in its database, and check that its mtime remains unchanged.
Only directories whose mtime has changed will need a full directory scan: that will uncover any new, renamed or deleted files, links and sub-directories. If new/renamed sub-directories are found, they will need to be fully scanned too.