UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XXVs4IRehxd1s+kLhOeQyGwPrDuKZrzgVSWHQryFtC4='
WHERE
key_id = '9a3d91feab3c4897e698a20b84023eb91a6e1c5cd09689ce2f1b585af1afdc5c'
AND (
token = 'XXVs4IRehxd1s+kLhOeQyGwPrDuKZrzgVSWHQryFtC4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)