Как is an old-fashioned poetical device, it doesn't really mean anything. Just say "once upon a time".

Как (-*-) у (by/near) наших (our) ворот (gate)

P.S. For the sake of rhythm you can double the У (как у наших у ворот, за горою).
It rhymes with "You can fly so very high, little birdy" by pitch and tempo.