UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gAYG0zJCFWgB/SHvXuh66pvRcBl344miNZRXmGMh5Ws='
WHERE
key_id = 'ff359f2884e18d32b1d88fa34a9e82720b5db19bcb359762600cf28fed49ec58'
AND (
token = 'gAYG0zJCFWgB/SHvXuh66pvRcBl344miNZRXmGMh5Ws='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)