UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'z9WWqAZs+JFvZHxP1yYdF8E+mIqpFij5l253BHTtjl4='
WHERE
key_id = '11c71bce30bf9b1c3a61f7f3e02f875cc1fbd1a5fda28f074778f168d7517933'
AND (
token = 'z9WWqAZs+JFvZHxP1yYdF8E+mIqpFij5l253BHTtjl4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)