You can cancel the remaining sudo timetout with
sudo -k
As explained here
But if you want to change the default from 15 minutes you can do so by
sudo visudo
This opens an editor and points it to the sudoers file -- Ubuntu defaults to nano, other systems use Vi. You're now a super user editing one of the most important files on your system. No stress!
(Vi specific instructions noted with (vi!). Ignore these if you're using nano)
Use the arrow keys to move to the end of the Defaults line.
(vi!) press the A (capital "a") key to move at the end of the current line and enter editing mode (append after the last character on the line).
Now type
,timestamp_timeout=X
where X is the timeout expiration in minutes. If you specify 0 you will always be asked the password. If you specify a negative value, the timeout will never expire. E.g.
Defaults env_reset,timestamp_timeout=5
(vi!) hit Escape to return to command mode. Now, if you're happy with your editing, type in :w to write the file and :q to exit vi. If you made a mistake, perhaps the easiest way is to redo from start, to exit without saving (hit Escape to enter the command mode) and then type :q! .
hit CTRL + X, then Y, then to save your file and exit nano.
You might want to read the sudoers and vi manual pages for additional information.
man sudoers
man vi
Most of this lifted directly from RootSudoTimeout in The official Ubuntu documentation