UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'C4DKaIAmyBWl++Z07xq9iYT517k1hPG23rHkofonv1A='
WHERE
key_id = '983818166b9ea8878915feeff47a253e9b4f60d988f810a1f7bde66fb95514ec'
AND (
token = 'C4DKaIAmyBWl++Z07xq9iYT517k1hPG23rHkofonv1A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)