UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xpMrWpbEQAjAfS77A6hVCMaT7waF/etLx4fkznO/cw8='
WHERE
key_id = '8ac550eee51bd8db7f6c34ba69303e92b68f1641368275e96c60338a93ed0899'
AND (
token = 'xpMrWpbEQAjAfS77A6hVCMaT7waF/etLx4fkznO/cw8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)