-# ${qos_tokens[3]/[-1] } = OSM.org exclusive / current
-# ${qos_tokens[2]/[-2] } = tile.openstreetmap.org default
-# ${qos_tokens[1]/[-3] } = stale ~ 1 hour
+SECONDS_AGO=$((${NUM_TOKENS} * ${VALID_TOKEN}))
+OLD_TIME=$(/bin/date -u "+%Y-%m-%dT %H:%M:%S %z" -d "${SECONDS_AGO} seconds ago")
+QOS_TOKENS=($(/usr/bin/oathtool --totp --now="${OLD_TIME}" --window=${NUM_TOKENS} --time-step-size=${VALID_TOKEN}s -b "<%= @totp_key %>"))
+
+# ${qos_tokens[4]/[-1] } = OSM.org exclusive / current
+# ${qos_tokens[3]/[-2] } = OSM.org exclusive / stale
+# ${qos_tokens[2]/[-3] } = tile.openstreetmap.org default
+# ${qos_tokens[1]/[-4] } = stale ~ 1 hour