UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'C9HzdwN4mx8p7+/UwtU+AbiymtQfEhAWMsTtv7HenXY='
WHERE
key_id = 'a259ea181c557798eb6d75adf6b9b8f27f08ec42d9353f4d5ff580dc7ea4614d'
AND (
token = 'C9HzdwN4mx8p7+/UwtU+AbiymtQfEhAWMsTtv7HenXY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)