UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4kysPRiNjm01vF0ZfJA83eXd0W0KsMsKyIBr8eZhpMg='
WHERE
key_id = '29f70bf9c2b0818636d4d737b544a481fd2fce2111fc015efabf530a6e0d5bd7'
AND (
token = '4kysPRiNjm01vF0ZfJA83eXd0W0KsMsKyIBr8eZhpMg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)