UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ErNdoBQz2F31+ZN9cbM1CUcD5XSuWH9GCcQBXoCdagk='
WHERE
key_id = '6dbd505ada0accead88c0f57bc7a63cddc0dfb593f5652a2b05edf95d32719dc'
AND (
token = 'ErNdoBQz2F31+ZN9cbM1CUcD5XSuWH9GCcQBXoCdagk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)