I do not know why the error, but it seems to be something of phantomjs.
And the timeout is not working because it is in the wrong place, waitForSelector method syntax is as follows:
waitForSelect (selector, then, ontimeout, timeout);
In your example would be something like
var token_button_class = 'ABC';
casper.waitForSelector('input[class="' + token_button_class + '"]',
function eWaitForButton() {
this.echo('Title: ' + this.getTitle() + '\n\n\n');
}, function() {
this.echo("Timeout reached");
// do something
},
300000);