UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wSSpsfTZbRLC0v56p9QcE3qEp/uvOxmBYxfcBQQr2cw='
WHERE
key_id = 'a397dc661c203ef4a498194d2b71f1a0c261434e20691fa10483e7ca3573077a'
AND (
token = 'wSSpsfTZbRLC0v56p9QcE3qEp/uvOxmBYxfcBQQr2cw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)