UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XCaPHPPo2GP0Nds99vXMNWQK6YVMRFPnRx5DhSA8dBg='
WHERE
key_id = 'e5b6d829954a425a066d09d6c83e02d8a2baa8982f571ffa222cb179f7043b89'
AND (
token = 'XCaPHPPo2GP0Nds99vXMNWQK6YVMRFPnRx5DhSA8dBg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)