UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GqNb0SOLHB8sdJVaJ1DAwx/NTMmK8e7BYAHoQDDFK18='
WHERE
key_id = 'dbccd5f70469aeeefd7722f94536d74f16e21bf968714263d76ed1ec479bc2a4'
AND (
token = 'GqNb0SOLHB8sdJVaJ1DAwx/NTMmK8e7BYAHoQDDFK18='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)