Depending on the length of what you're querying, there may be other tools worth considering for shorter sequence queries, in addition to
blat (especially if working with sequences less than 20nt long).
blastn has a
blastn-short argument that may be useful here. Bowtie is another option, and Bowtie 1 may be better (more accurate) than Bowtie 2 for this task, for instance; see: http://bowtie-bio.sourceforge.net/bowtie2/manual.shtml
If you want to investigate the command-line version of UCSC
blat, I put together a write-up that explains how to compile it, how to create a filter for speeding up queries, and an example of how to query: http://www.bitsumma.com/2017/09/03/how-to-install-and-set-up-a-local-ucsc-blat-environment/
It depends a lot on your query and database and how much memory you have available.
I wrote this blog post about BLAST and some faster alternatives depending on some conditions.