UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5EU7LI8Cq5GU6Vfa5xWqV0MUbFJaupl2VoiwjVso6Xs='
WHERE
key_id = '7e306602e334b698addc05cd440ea8c03416ca266ac2c12b89bdb1b79592fc84'
AND (
token = '5EU7LI8Cq5GU6Vfa5xWqV0MUbFJaupl2VoiwjVso6Xs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)