UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TBTHb1hJmn7jqxQQaLhF7UqLd0UXkBv9jmAvE8G60nc='
WHERE
key_id = 'df896940427df1bcf914057598702d183009face8500009f8f382901fca0c517'
AND (
token = 'TBTHb1hJmn7jqxQQaLhF7UqLd0UXkBv9jmAvE8G60nc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)