UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QEWm2gX/+4RwO9jUpF5j8oXdXQ/UyufamzOqPhEvyKk='
WHERE
key_id = '7bd31039f65dbee0eb6b7295813090fbbdcf467afae2983663184aed326e3ff0'
AND (
token = 'QEWm2gX/+4RwO9jUpF5j8oXdXQ/UyufamzOqPhEvyKk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)