UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PNCqrrfqLvh8WgKyHjYPFWcrmE7N9c1JAOiCBF8yMDY='
WHERE
key_id = 'a6241c0513a476fa33a93a951aee2f1760bb7702c22403a8fe66efca919fd440'
AND (
token = 'PNCqrrfqLvh8WgKyHjYPFWcrmE7N9c1JAOiCBF8yMDY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)