UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bfPjLrxqcYSccPS6r9O5Eai0QnqMmkb2pOcNASCs9q4='
WHERE
key_id = '510a6eedbdab70db03f2285ec19f11862c2c8ee65b710d5d67324a9c981e3721'
AND (
token = 'bfPjLrxqcYSccPS6r9O5Eai0QnqMmkb2pOcNASCs9q4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)