UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NQNYKiX7pY4AJAquMnHVygWLjkX92E0abpGc8yuTZV0='
WHERE
key_id = '4ffe41c99b58fa901afab1d030e3a796ed0cad37eb35eaee99419a3cf278deb7'
AND (
token = 'NQNYKiX7pY4AJAquMnHVygWLjkX92E0abpGc8yuTZV0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)