[backup] Extract function to query DDB index
Summary: Noticed that the same query is used in two places, and I'm going to introduce third one.
Test Plan: Created two backups. Made sure that behavior hasn't been changed: the latest is retrieved, and the old is removed.
Reviewers: kamil, marcin, varun
Reviewed By: kamil
Subscribers: ashoat, tomek
Differential Revision: https://phab.comm.dev/D12970