[agent] utils/findKey perf refactor

removed the path var declaration from the loops

used `_.find` instead of `_.each` to stop the loop if `theKey` is found
`any` would probably be even faster until `_.findKey`  is added (its in lodash + underscore@1.8)