UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nLhHuBK4++wtQhkJWSo7s9i8k4W85dPAT6TcNzjvj58='
WHERE
key_id = 'f7fc9d44b81bfdea68ce039da949cf1865013d3964a697107e488509742aa032'
AND (
token = 'nLhHuBK4++wtQhkJWSo7s9i8k4W85dPAT6TcNzjvj58='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)