UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kqE/dI3t/6+CaYkagyYIeIH5J01kqT6KtQJNuveAJSA='
WHERE
key_id = 'e35191592775b46c35f33bfd0cd8e29e86440d843f6506c902c36cc8091ca646'
AND (
token = 'kqE/dI3t/6+CaYkagyYIeIH5J01kqT6KtQJNuveAJSA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)