UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dKkNy+/ShzrGg/4U/b4GGixGG8YNhG0fjOx9Z+RYqxM='
WHERE
key_id = '9849fef0009c41779e41f159c083a2aaf4224b94fe10f55806da7ffa60589e38'
AND (
token = 'dKkNy+/ShzrGg/4U/b4GGixGG8YNhG0fjOx9Z+RYqxM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)