q={input} is the query.
and as_qdr asks for the last results. Here the syntax is pretty obvious #y = number of years, #m = number of months, etc...
So, if you wanted to do what you did above and make it so it's always two years, then you'd grab the {query} and substitute "+" for " ". Then, you'd create the base URL:
http://www.google.com/search?q={parsed_query}
And then you'd append the time string: "&as_qdr=2y".
After that, you would just open the location in whatever browser you want.
If you want to show the results in Alfred, then you'll have to pull in the results in json or xml or something. Here's a really old blog post showing you how to use an API that is deprecated but still seems to work: http://googlesystem.blogspot.com/2008/04/google-search-rest-api.html.