UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yFt3+yXxTtPYvjg+9r6K+v9HHawkEc7ubPKag0XkBeI='
WHERE
key_id = '8c7989ad88fa68d8b6f32d399faa51f1577d80d8c3fef33488ca4433ad3c065c'
AND (
token = 'yFt3+yXxTtPYvjg+9r6K+v9HHawkEc7ubPKag0XkBeI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)