UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ww/F2c1kO8C9h7jKOq1r78NryD39KPSA/xA8fsLdtDg='
WHERE
key_id = 'cb6fe75950d814b4477ccdcf22f6c212bb1917473f51cb21910328a4b3e42241'
AND (
token = 'Ww/F2c1kO8C9h7jKOq1r78NryD39KPSA/xA8fsLdtDg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)